@inject('appRepository', 'App\Repositories\AppRepository')

@php
    $banner = $appRepository->getContentByColumn('ContentPicture',5,'新闻页','新闻页banner');
@endphp
@extends('layouts.app',['navShow'=>true])
@section('title',"培优策-{$content->title}")
@section('content')
@if($banner && count($banner))
    <div id="myCarousel" class="carousel slide" data-ride="carousel">
        <ol class="carousel-indicators">
            @foreach($banner as$key=> $item)
                <li data-target="#myCarousel" data-slide-to="0" class="{{$key===0?'active':''}}"></li>
            @endforeach
        </ol>
        <div class="carousel-inner">
            @foreach($banner as $key=>$item)
                <div class="carousel-item {{$key===0?'active':''}}">
                    <img class="img-fluid"
                         src="{{$item->content_detail->assets_path}}"
                         alt="First slide">
                    <div class="container">
                        <div class="carousel-caption text-left">
                            <h1>{{$item->title}}</h1>
                        </div>
                    </div>
                </div>
            @endforeach
        </div>
        <a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>
@endif
    <div class="container-fluid news-bg my-5">
        <div class="container">
            <div class="row mb-5 pb-5">
                <div class="col-xl-8 news-list-table">
                    <div class="news-title row">
                        <div class="col-4 news-photo">
                            <img src="{{$content->content_detail->asset->path}}" class="img-fluid" alt="">
                        </div>
                        <div class="col">
                            <div class="news-contents-title">
                                {{$content->title}}
                            </div>
                            @php
                                $time = \Carbon\Carbon::parse($content->created_at);
                            @endphp
                            <div class="news-contents-desc">
                                <p>{{$time->year}}/{{$time->month}}/{{$time->day}}
                                    &nbsp;&nbsp;&nbsp;{{$time->hour}}:{{$time->minute}}
                                    &nbsp;&nbsp;&nbsp;
                                    &nbsp;&nbsp;&nbsp;
                                    &nbsp;&nbsp;&nbsp;
                                    <span><i class="fa fa-eye"></i>&nbsp;&nbsp;&nbsp;{{$content->view_count}}</span></p>
                            </div>
                        </div>
                    </div>
                    <div class="content-text mt-5 mr-5">
                        {!! $content->content_detail->content !!}
                    </div>
                </div>
                <div class="col-xl-4 news-left">
                    @include('layouts.left')
                </div>
            </div>
            <hr>
            <div class="row">
                <div class="content-title mt-3">
                    <div class="content-title-img">
                        <div class="news-list-title"><h3>相关新闻推荐</h3></div>
                    </div>
                </div>
                <div class="row tuijian-list mt-4 ml-1">
                    @foreach($tuijian as $item)
                        <div class=" media mb-3 pb-3 col-12 ">
                            <div class="tuijian-photo">
                                <img src="{{$item->content_detail->asset->path}}"  class="img-fluid " alt="">
                            </div>
                            <div class="media-body col-8 pt-2 pl-5 ">
                                <a href="{{url('content',['id'=>$item->id])}}" target="_blank">
                                    <h4 class="news-title text-o">{{$item->title}}</h4>
                                </a>
                                {{$item->keywords}}
                                <div class="news-contents-desc mt-3">
                                    <p>{{$time->year}}/{{$time->month}}/{{$time->day}}
                                        &nbsp;&nbsp;&nbsp;{{$time->hour}}:{{$time->minute}}
                                        &nbsp;&nbsp;
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                                        &nbsp;&nbsp;&nbsp;
                                        <span><i class="fa fa-eye"></i>&nbsp;&nbsp;&nbsp;{{$item->view_count}}</span></p>
                                </div>
                            </div>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
    </div>
@endsection